﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.Admin.Core.Repository/SSPivotRepositoryImpl 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       SSPivotRepositoryImpl
* 创建时间：  2025/6/4 10:54:21
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion
using SSPivot.Admin.Core.DbContexts;
using SSPivot.AspNetCore.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.Admin.Core.Repository
{
    public class SSPivotRepositoryImpl<TEntity> : EfRepository<TEntity>, ISSPivotRepository<TEntity> where TEntity : class, new()
    {
        private readonly IDbContextFactory _dbContextFactory;
        public SSPivotRepositoryImpl(IDbContextFactory dbContextFactory):base(dbContextFactory)  
        {
            base.DbContext = _dbContextFactory.CreateDbContext(null);
            base.ReadDbContext= _dbContextFactory.CreateReadDbContext(null);
        }
 
        public SSPivotDbContext GetSSPivotReadDbContext()
        {
            return (SSPivotDbContext)this.ReadDbContext;
        }

        public SSPivotDbContext GetSSPivotDbContext()
        {
            return (SSPivotDbContext)this.DbContext;
        }
    }
}
